/**
 * 权限相关的API
 *
 * @author 橘柚
 * @Date 2024/12/5 8:21
 * @Description
 */
import {useGet, usePost} from "@/utils/request";
import type {API} from "@/type/type";

/**
 * 登录接口
 * @param username 用户名或者邮箱
 * @param password 密码
 */
export const loginAPI = (username: string, password: string) => {
  return usePost<any>('/auth/account/login', {username, password})
}

/**
 * 登出接口
 */
export const logoutAPI = () => {
  return useGet<any>('/auth/logout')
}

export const getUserInfoAPI = () => {
  return useGet<API.ICurrentUser>('/auth/currentUser')
}

/**
 * 修改用户密码
 */
export const resetPasswordAPI = (data: { newPassword: string; oldPassword: string }) => {
  return usePost<boolean>('/auth/resetPassword', data)
}
